package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Application;
import com.briup.recognition.bean.ApplicationExample;
import com.briup.recognition.dao.ApplicationMapper;
import com.briup.recognition.service.IApplicationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: charles
 * @create: 2021-03-28 15:11
 **/
@Service
public class ApplicationServiceImpl implements IApplicationService {

    @Resource
    private ApplicationMapper applicationMapper;

    @Override
    public List<Application> query() {
        ApplicationExample example = new ApplicationExample();
        // 条件

        return applicationMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Application application) {
        if(application.getId()!=null){
            applicationMapper.updateByPrimaryKey(application);
        } else {
            applicationMapper.insert(application);
        }
    }

    @Override
    public void deleteById(long id) {
        applicationMapper.deleteByPrimaryKey(id);
    }
}

